
local CollisionTool = {}

function CollisionTool:judgeCollision(object1, object2)
	if math.abs(object1.posX - object2.posX) < math.abs(object1.width / 2 + object2.width / 2) 
		and math.abs(object1.posY - object2.posY) < math.abs(object1.height / 2 + object2.height / 2) then
		return true;
	end
	return false;
end

-- 检查合体区域
function CollisionTool:judgeFit(object1, object2)
	if math.abs(object1:getInfo().posX - object2:getInfo().posX) < 50 
		and math.abs(object1:getInfo().posY - object2:getInfo().posY) < 50 then
		return true;
	end
	return false;
end

return CollisionTool